
<style scoped>
.el-row{
  height: 100%;
}

.el-menu{
  border-right:none;
}
.el-aside{
  border-right: 1px solid #f5f1f1;
}
</style>

<template>
  <el-aside width="200px">
    <el-row class="tac">
      <el-col>
        <el-menu
          default-active="1"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
        >
          <el-menu-item index="1" @click="goPage('layout/book')">
            <i class="el-icon-menu"></i>
            <span slot="title">图书管理</span>
          </el-menu-item>

          <el-menu-item index="2" @click="goPage('layout/user')">
            <i class="el-icon-s-order"></i>
            <span slot="title">会员管理</span>
          </el-menu-item>

          <el-menu-item index="3" @click="goPage('layout/area')">
            <i class="el-icon-location"></i>
            <span slot="title">区域管理</span>
          </el-menu-item>

          <el-menu-item index="4" @click="goPage('layout/type')">
            <i class="el-icon-view"></i>
            <span slot="title">类型管理</span>
          </el-menu-item>

          <el-submenu index="5">
            <template slot="title">
              <i class="el-icon-office-building"></i>
              <span slot="title">借阅与归还</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="5-1" @click="goPage('layout/loan')">
                <i class="el-icon-folder-remove"></i>
                <span slot="title" >借阅与归还</span>
                </el-menu-item>
              <el-menu-item index="5-2" @click="goPage('layout/filing')">
                <i class="el-icon-folder-add"></i>
                <span slot="title">归还信息表</span>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-col>
    </el-row>
  </el-aside>
</template>

<script>
var $this = {};
export default {
  data() {
    return {};
  },
  beforeCreate() {
    $this = this;
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },

    //跳转到某个导航页
    goPage(link) {
      if (link === "layout/book") {
        $this.$router.push("/layout/book").catch(error => error);
      }if (link === "layout/user") {
        $this.$router.push("/layout/user").catch(error => error);
      }if (link === "layout/area") {
        $this.$router.push("/layout/area").catch(error => error);
      }if (link === "layout/type") {
        $this.$router.push("/layout/type").catch(error => error);
      }if (link === "layout/loan") {
        $this.$router.push("/layout/loan").catch(error => error);
      }if (link === "layout/filing") {
        $this.$router.push("/layout/filing").catch(error => error);
      } 

    }
  }
};
</script>